package com.ruoyi.web.controller.wnjk.app.shop;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.system.pay.service.IPayService;
import com.ruoyi.system.wnjk.domain.dto.ReceiveItemDTO;
import com.ruoyi.system.wnjk.domain.po.ShopAfterSalesRequests;
import com.ruoyi.system.wnjk.service.IShopAfterSalesRequestsService;
import com.ruoyi.system.wnjk.service.IShopOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/app/shop/after_sales_requests")
public class AppShopAfterSalesRequestsController extends BaseController {

    @Autowired
    private IShopAfterSalesRequestsService shopAfterSalesRequestsService;

    @GetMapping("/list")
    public TableDataInfo list(ShopAfterSalesRequests shopAfterSalesRequests)
    {
//        LoginUser loginUser = SecurityUtils.getLoginUser();
        startPage();
        List<ShopAfterSalesRequests> list = shopAfterSalesRequestsService.selectShopAfterSalesRequestsList(shopAfterSalesRequests);
        return getDataTable(list);
    }

    @PostMapping
    public AjaxResult postAfterSaleRequest(@RequestBody ShopAfterSalesRequests shopAfterSalesRequests){
        System.out.println(shopAfterSalesRequests);
//        return success();
        return toAjax(shopAfterSalesRequestsService.postAfterSaleRequest(shopAfterSalesRequests));
    }

    @PostMapping("/receive_itme")
    public AjaxResult receiveItem(@RequestBody  ReceiveItemDTO receiveItemDTO){
        System.out.println(receiveItemDTO);
        return toAjax(shopAfterSalesRequestsService.receiveItem(receiveItemDTO));
    }

}
